home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //==================================================================
- // MayaHardware Renderer Tab
- //==================================================================
-
- // Description:
- // This procedure is called to build the "Render Option" frame
- // in the "Hardware" tab for the Maya hardware renderer in
- // the unified render globals.
- //
- proc createHardwareRenderOptionsFrame (string $parent)
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
-
- columnLayout -adjustableColumn true rgQualityLayout;
-
- attrControlGrp -attribute "hardwareRenderGlobals.enableRenderLayers"
- -cc updateMayaHardwareTargetFilePreview;
-
- attrControlGrp -attribute "hardwareRenderGlobals.culling";
-
- separator;
-
- // Motion Blur
- //
- attrControlGrp -label "Enable Motion Blur"
- -attribute "hardwareRenderGlobals.enableMotionBlur"
- -cc "updateMayaHardwareMotionBlur";
-
- attrControlGrp -label "Motion Blur By Frame"
- -attribute "hardwareRenderGlobals.motionBlurByFrame"
- -enable `getAttr "hardwareRenderGlobals.enableMotionBlur"`
- mayaHardwareMotionBlurByFrame;
-
- attrControlGrp -label "Number of Exposures"
- -attribute "hardwareRenderGlobals.numberOfExposures"
- -enable `getAttr "hardwareRenderGlobals.enableMotionBlur"`
- mayaHardwareNumberOfExposures;
-
-
-
- attrControlGrp -attribute "hardwareRenderGlobals.enableGeometryMask";
-
- setParent ..;
- setUITemplate -popTemplate;
- }
-
- // Description:
- // This procedure is called to create the "Hardware" globals tab
- // in the unified render globals for the maya hardware renderer.
- //
- global proc createMayaHardwareGlobalsTab()
- {
- string $parentForm = `setParent -query`;
- scrollLayout -horizontalScrollBarThickness 0 scrollLayout;
- columnLayout -adjustableColumn true;
-
- frameLayout -labelVisible false -collapsable false -collapse false;
- columnLayout -adjustableColumn true;
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- // Hardware Render Quality
- //
- frameLayout -label "Quality"
- -collapsable true -collapse false
- hwQualityFrame;
-
- createHardwareRenderQuality ("hwQualityFrame");
- setParent ..;
-
- // Hardware Render Options
- //
-
- frameLayout -label "Render Options"
- -collapsable true -collapse false
- hwRenderOptionsFrame;
-
- createHardwareRenderOptionsFrame ("hwRenderOptionsFrame");
- setParent ..;
-
-
- setUITemplate -popTemplate;
- setParent ..;
- setParent ..;
-
- setParent ..;
- setParent ..;
-
- formLayout
- -edit
- -af scrollLayout "top" 0
- -af scrollLayout "bottom" 0
- -af scrollLayout "left" 0
- -af scrollLayout "right" 0
- $parentForm;
-
- updateHardwareQualityPresetMenu();
- }
-
-
- // Description:
- // This procedure is called to update the "Motion Blur" frame.
- // in the "Hardware" tab in the unified render globals window.
- //
- global proc updateMayaHardwareMotionBlur()
- {
- attrControlGrp
- -edit
- -enable `getAttr "hardwareRenderGlobals.enableMotionBlur"`
- mayaHardwareMotionBlurByFrame;
-
- attrControlGrp
- -edit
- -enable `getAttr "hardwareRenderGlobals.enableMotionBlur"`
- mayaHardwareNumberOfExposures;
-
- }
-
- // Description:
- // This procedure is called to create the "Render Quality"
- // frame in the "Hardware" tab in the unified render globals window.
- //
- global proc createHardwareRenderQuality (string $parent)
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
-
- columnLayout -adjustableColumn true rgQualityLayout;
-
- createHardwareQualityPresetMenu();
-
- // High Quality Lighting
- //
- attrControlGrp -label "Enable High Quality Lighting"
- -attribute "hardwareRenderGlobals.enableHighQualityLighting"
- -cc " updateHardwareQualityPresetMenu";
-
- // Accelerated multi-sampling (for hardware anti-aliasing)
- //
- attrControlGrp -label "Enable Accelerated Multi-Sampling"
- -attribute "hardwareRenderGlobals.enableAcceleratedMultiSampling"
- -cc " updateHardwareQualityPresetMenu";
-
- attrControlGrp
- -attribute "hardwareRenderGlobals.numberOfSamples"
- -cc "updateHardwareQualityPresetMenu";
- // hardwareNumberOfSamples;
-
- separator;
-
- // Transparency Quality
- //
- // WAITING WAITING WAITING
- // WAITING FOR sync to the latest build which contains
- // enableTransparency attributes.
- //
-
- // attrControlGrp
- // -attribute "hardwareRenderGlobals.enableTransparency"
- // -cc "updateHardwareQualityPresetMenu();"
- // hardwareEnableTransparency;
-
- attrControlGrp
- -label "Transparent Shadow Casting"
- -attribute "hardwareRenderGlobals.transparentShadowCasting";
-
- rowLayout -numberOfColumns 2;
- text -label "Transparency Sorting";
- optionMenu
- -cc "hardwareTransparencySortingMenuChanged"
- hardwareTransparencySortingMenu;
- menuItem -label "Per Object";
- menuItem -label "Per Polygon";
-
- updateHardwareTransparencySortingMenu();
-
-
- scriptJob -p hardwareTransparencySortingMenu
- -ac "hardwareRenderGlobals.transparencySorting"
- updateHardwareTransparencySortingMenu;
- setParent ..; // from rowLayout
-
- separator;
-
- // Texture Quality
- //
- attrControlGrp
- -label "Color Texture Resolution"
- -attribute "hardwareRenderGlobals.colorTextureResolution"
- -cc "updateHardwareQualityPresetMenu";
-
- attrControlGrp
- -label "Bump Texture Resolution"
- -attribute "hardwareRenderGlobals.bumpTextureResolution"
- -cc "updateHardwareQualityPresetMenu";
-
- attrControlGrp
- -label "Texture Compression"
- -attribute "hardwareRenderGlobals.textureCompression";
-
- setParent ..;
- setUITemplate -popTemplate;
- }
-
- global proc updateHardwareTransparencySortingMenu()
- {
- int $sorting = `getAttr hardwareRenderGlobals.transparencySorting`;
- $sorting++;
- optionMenu -edit -select $sorting hardwareTransparencySortingMenu;
- updateHardwareQualityPresetMenu;
- }
-
- global proc hardwareTransparencySortingMenuChanged()
- {
- int $sorting = `optionMenu -query -select hardwareTransparencySortingMenu`;
- $sorting--;
- setAttr hardwareRenderGlobals.transparencySorting $sorting;
- }
-
- global proc updateMayaHardwareGlobalsTab()
- {
- }
-
- global proc mayaHardwareGlobalsRevertToDefault()
- {
- }
-
- // Description:
- // This procedure is called to create the "Quality Preset" menu in
- // the "Hardware" tab in the unified render globals window.
- //
- global proc createHardwareQualityPresetMenu()
- {
- optionMenuGrp -label "Presets" hardwareQualityPresetMenu;
- optionMenuGrp -edit -cc hardwareSetDefaultQuality -cw 2 240 hardwareQualityPresetMenu;
-
- menuItem -label "Custom" hardwareCustomQuality;
- menuItem -label "Preview Quality" hardwarePreviewQuality;
- menuItem -label "Intermediate Quality" hardwareIntermediateQuality;
- menuItem -label "Production Quality" hardwareProductionQuality;
- menuItem -label "Production Quality with Transparency" hardwareProdWithTransparency;
-
- }
-
- // Description: This procedure is called when a particular
- // quality preset is chosen in the render quality frame.
- // It sets some attributes according to the chosen quality preset.
- //
- global proc hardwareSetDefaultQuality ()
- {
- string $renderer = "mayaHardware";
- string $globalsNodes[] = `renderer -query -globalsNodes $renderer`;
- string $curr = `optionMenuGrp -q -v hardwareQualityPresetMenu`;
- if ($curr == "Preview Quality")
- {
- setAttr ($globalsNodes[0] + ".enableHighQualityLighting") off;
- setAttr ($globalsNodes[0] + ".enableAcceleratedMultiSampling") off;
- setAttr ($globalsNodes[0] + ".enableEdgeAntiAliasing") off; // M6 to be removed
- setAttr ($globalsNodes[0] + ".numberOfSamples") 1;
- setAttr ($globalsNodes[0] + ".colorTextureResolution") 128;
- setAttr ($globalsNodes[0] + ".bumpTextureResolution") 256;
- setAttr ($globalsNodes[0] + ".transparencySorting") 0;
- }
- else if ($curr == "Intermediate Quality")
- {
- setAttr ($globalsNodes[0] + ".enableHighQualityLighting") on;
- setAttr ($globalsNodes[0] + ".enableAcceleratedMultiSampling") on;
- setAttr ($globalsNodes[0] + ".enableEdgeAntiAliasing") on; // M6 to be removed
- setAttr ($globalsNodes[0] + ".numberOfSamples") 1;
- setAttr ($globalsNodes[0] + ".colorTextureResolution") 256;
- setAttr ($globalsNodes[0] + ".bumpTextureResolution") 512;
- setAttr ($globalsNodes[0] + ".transparencySorting") 0;
- } else if ($curr == "Production Quality")
- {
- setAttr ($globalsNodes[0] + ".enableHighQualityLighting") on;
- setAttr ($globalsNodes[0] + ".enableAcceleratedMultiSampling") on;
- setAttr ($globalsNodes[0] + ".enableEdgeAntiAliasing") on; // M6 to be removed
- setAttr ($globalsNodes[0] + ".numberOfSamples") 9;
- setAttr ($globalsNodes[0] + ".colorTextureResolution") 512;
- setAttr ($globalsNodes[0] + ".bumpTextureResolution") 1024;
- setAttr ($globalsNodes[0] + ".transparencySorting") 0;
- }
- else if ($curr == "Production Quality with Transparency")
- {
- setAttr ($globalsNodes[0] + ".enableHighQualityLighting") on;
- setAttr ($globalsNodes[0] + ".enableAcceleratedMultiSampling") on;
- setAttr ($globalsNodes[0] + ".enableEdgeAntiAliasing") on; // M6 to be removed
- setAttr ($globalsNodes[0] + ".numberOfSamples") 9;
- setAttr ($globalsNodes[0] + ".colorTextureResolution") 512;
- setAttr ($globalsNodes[0] + ".bumpTextureResolution") 1024;
- setAttr ($globalsNodes[0] + ".transparencySorting") 1;
- }
- else // Custom Quality
- {
- // WAITING for a bug fix for "enable" to work for attrControlGrp
- // for enum controls.
- //
- // attrControlGrp -edit -enable true hardwareNumberOfSamples;
- }
-
- // updateHardwareRenderQuality ()
- }
-
- // Description: This procedure is called to update the
- // "Quality Preset" menu in the "Hardware" tab in
- // the unified render globals window.
- //
- global proc updateHardwareQualityPresetMenu()
- {
- string $renderer = "mayaHardware";
- string $globalsNodes[] = `renderer -query -globalsNodes $renderer`;
- int $enableHighQualityLighting =
- `getAttr ($globalsNodes[0] + ".enableHighQualityLighting")`;
- int $enableAcceleratedMultiSampling=
- `getAttr ($globalsNodes[0] + ".enableAcceleratedMultiSampling")`;
- int $numberOfSamples =
- `getAttr ($globalsNodes[0] + ".numberOfSamples")`;
- int $colorTextureResolution =
- `getAttr ($globalsNodes[0] + ".colorTextureResolution")`;
- int $bumpTextureResolution =
- `getAttr ($globalsNodes[0] + ".bumpTextureResolution")`;
- int $transparencySorting =
- `getAttr ($globalsNodes[0] + ".transparencySorting")`;
-
- // See if the current settings of the 5 attributes we just queried
- // match any preset settings, and set the Presets menu state
- // accordingly
- //
- if ($enableHighQualityLighting == off && $enableAcceleratedMultiSampling == off
- && $numberOfSamples == 1
- && $colorTextureResolution == 128 && $bumpTextureResolution == 256
- && $transparencySorting == 0 )
- {
- optionMenuGrp -edit -sl 2 hardwareQualityPresetMenu; // Preview Quality
- }
- else if ($enableHighQualityLighting == on && $enableAcceleratedMultiSampling == on
- && $numberOfSamples == 1
- && $colorTextureResolution == 256 && $bumpTextureResolution == 512
- && $transparencySorting == 0 )
- {
- optionMenuGrp -edit -sl 3 hardwareQualityPresetMenu; // Intermediate Quality
- }
- else if ($enableHighQualityLighting == on && $enableAcceleratedMultiSampling == on
- && $numberOfSamples == 9
- && $colorTextureResolution == 512 && $bumpTextureResolution == 1024
- && $transparencySorting == 0 )
- {
- optionMenuGrp -edit -sl 4 hardwareQualityPresetMenu; // Production Quality
- }
- else if ($enableHighQualityLighting == on && $enableAcceleratedMultiSampling == on
- && $numberOfSamples == 9
- && $colorTextureResolution == 512 && $bumpTextureResolution == 1024
- && $transparencySorting == 1 )
- {
- optionMenuGrp -edit -sl 5 hardwareQualityPresetMenu; // Production Quality with Transparency
- }
- else {
- optionMenuGrp -edit -sl 1 hardwareQualityPresetMenu; // Custom
- }
- }
-